<template>
  <div class="assessment-container assessment-change-plan-container" style="width:100%">
    <div class="search-container">
      <div class="search-container-left">
        <div class="import-button" @click="toscore" style="margin:0">
          <img src="../../../assets/assessment/icon-import.png" alt="" />
          <span>成绩修改日志查询</span>
        </div>
      </div>
      <div class="search-container-right">
      </div>
    </div>
    <div class="manual-entry-container">
      <div style="width:100%">
        <ul>
          <li>
            <span class="active">课程编号</span>
            <span> {{ firstTableList.coursenumber }} </span>
            <span class="active">课程名称</span>
            <span>{{ firstTableList.coursename }}</span>
            <span class="active">学 分</span>
            <span>{{ firstTableList.credithour }}</span>
            <span class="active">任课教员</span>
            <span>{{ firstTableList.teachingfaculty }}</span>
          </li>
          <li>
            <span class="active">总评成绩</span>
            <span>{{ baseInfo.scorenumber }}</span>
            <span class="active">录入成绩分制</span>
            <span>{{ firstTableList.scoretypecode }}</span>
          </li>
          <li>
            <span class="active">课下作业成绩所占比例</span>
            <span>{{ firstTableList.usualscorerate }}</span>
            <span class="active">课堂测试成绩所占比例</span>
            <span>{{ firstTableList.examscorerate }}</span>
            <span class="active">期中考试成绩所占比例</span>
            <span>{{ firstTableList.midtermscorerate }}</span>
            <span class="active">课终考核成绩所占比例</span>
            <span>{{ firstTableList.experimentscorerate }}</span>
          </li>
        </ul>
      </div>
    </div>
    <div class="my-form-container" style="width:100%;height: 240px">
      <el-row class="my-form-item">
        <el-col :span="12">
          <div class="my-form-item-label">课下作业成绩</div>
          <div class="my-form-item-value">
            <span>{{ baseInfo.checkusualscore }}</span>
            <span class="red-tip">变更为</span>
            <el-input
              size="small"
              style="width: 99px"
              v-model="base.checkusualscore"
            ></el-input>
          </div>
        </el-col>
        <el-col :span="12">
          <div class="my-form-item-label">课堂测试成绩</div>
          <div class="my-form-item-value">
            <span>{{ baseInfo.checkexperimentscore }}</span>
            <span class="red-tip">变更为</span>
            <el-input
              size="small"
              style="width: 99px"
              v-model="base.checkexperimentscore"
            ></el-input>
          </div>
        </el-col>
      </el-row>
      <el-row class="my-form-item">
        <el-col :span="12">
          <div class="my-form-item-label">期中考试成绩</div>
          <div class="my-form-item-value">
            <span>{{ baseInfo.checkmidtermscore }}</span>
            <span class="red-tip">变更为</span>
            <el-input
              size="small"
              style="width: 99px"
              v-model="base.checkmidtermscore"
            ></el-input>
          </div>
        </el-col>
        <el-col :span="12">
          <div class="my-form-item-label">课终考试成绩</div>
          <div class="my-form-item-value">
            <span>{{ baseInfo.issue }}</span>
            <span class="red-tip">变更为</span>
            <el-input
              size="small"
              style="width: 99px"
              v-model="base.issue"
            ></el-input>
          </div>
        </el-col>
      </el-row>
      <el-row class="my-form-item">
        <el-col :span="12">
          <div class="my-form-item-label">原始成绩性质</div>
          <div class="my-form-item-value">
            <span>{{ baseInfo.naturecourse }}</span>
            <span class="red-tip">变更为</span>
            <el-select
              v-model="base.naturecourse"
              placeholder="请选择"
              size="small"
              style="width: 187px"
            >
              <el-option
                v-for="item in paperMethods"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </div>
        </el-col>
      </el-row>
      <el-row class="my-form-item">
        <el-col :span="12">
          <div class="my-form-item-label">补考成绩</div>
          <div class="my-form-item-value">
            <span>{{ baseInfo.oldmakeupscore }}</span>
            <span class="red-tip">变更为</span>
            <el-input
              size="small"
              style="width: 99px"
              v-model="base.oldmakeupscore"
            ></el-input>
          </div>
        </el-col>
        <el-col :span="12">
          <div class="my-form-item-label">毕业前补考成绩</div>
          <div class="my-form-item-value">
            <span>{{ baseInfo.oldmakeupscore2 }}</span>
            <span class="red-tip">变更为</span>
            <el-input
              size="small"
              style="width: 99px"
              v-model="base.oldmakeupscore2"
            ></el-input>
          </div>
        </el-col>
      </el-row>
    </div>
    <div class="button-group">
      <el-button class="btn" type="text" @click="dowms()">保存</el-button>
    </div>
  </div>
</template>

<script>
import {
  querycjplanid,
  updatewinster,
  reqQuerycjplanid,
  down
} from "@/api/admin1/check";

export default {
  data() {
    return {
      stuid: "",
      base: {
        checkusualscore: "", //课下成绩
        checkexperimentscore: "", //课堂成绩
        checkmidtermscore: "", //期中
        issue: "", //课终考试成绩
        naturecourse: "", //原始成绩性质
        oldmakeupscore: "", //补考成绩
        oldmakeupscore2: "",
      },
      baseInfo: {
        courseno: "131312",
        prelectcourse: "131312",
        scorenumber: "131312",
        checkusualscore: "131312",
        checkexperimentscore: "",
        checkmidtermscore: "",
        issue: "",
        oldmakeupscore2: "",
        usualscorerate: "",
        examscorerate: "",
        midtermscorerate: "",
        experimentscorerate: "",
        credithour: "",
        scoretypecode: "",
        teachingfaculty: "",
        planid: "",
        studentid: "",
        name: "",
      },
      coursenumber: "131312",
      coursename: "英语课",
      studytype: "13",
      studytypes: "李教员",
      v0: "98",
      v2: "百分制",
      v3: "",
      v4: "",
      z1: "95%",
      z2: "95%",
      z3: "95%",
      z4: "95%",

      v1: "",
      xq: "2020春",
      xqList: [
        {
          value: "2020春",
          label: "2020春",
        },
        {
          value: "2020夏",
          label: "2020夏",
        },
      ],

      design: "",
      classrooms: [
        { label: "教室一", value: "教室一" },
        { label: "教室二", value: "教室二" },
        { label: "教室三", value: "教室三" },
      ],
      naturecourse: "教室一",
      paperMethods: [
        { label: "补考", value: "补考" },
        { label: "毕业前补考", value: "毕业前补考" },
        { label: "请选择", value: "请选择" },
      ],
      selectPaperMethod: "笔试考卷",
      a1: "",
      a2: "",
      a3: "",
      a4: "",
      a5: "",
      a6: "",
      // 第一个表格的数据格式
      firstTableList: {
        // //课程编号
        // coursenumber: "",
        // // 课程名称
        // coursename: "",
        // // 学分
        // credithour: "",
        // // 任课教员
        // teachingfaculty: "",
        // // 录入成绩分制
        // scoretypecode: "",
        // // 课下作业成绩所占比例
        // usualscorerate: "",
        // // 课堂测试成绩所占比例
        // examscorerate: "",
        // // 其中考试成绩所占比例
        // midtermscorerate: "",
        // // 课终考核成绩所占比例
        // experimentscorerate: ""
      },
    };
  },
  mounted() {
    this.checkFIrstTable();
    this.querycjplanid();
  },
  methods: {
    // 根据planid查询第一个table
    async checkFIrstTable() {
      const result = await reqQuerycjplanid(this.$route.query.planid);
      if (result.data.code == 200) {
        this.firstTableList = result.data.data;
      }
    },
    //根据ID查询已审核成绩
    querycjplanid() {
      return new Promise(() => {
        querycjplanid(this.$route.query.id).then((res) => {
          if (res.data.code == 200) {
            this.baseInfo = res.data.data;
            this.base.checkusualscore = res.data.data.checkusualscore;
            this.base.checkexperimentscore = res.data.data.checkexperimentscore;
            this.base.checkmidtermscore = res.data.data.checkmidtermscore;
            this.base.issue = res.data.data.issue;
            this.base.naturecourse = res.data.data.naturecourse;
            this.base.oldmakeupscore = res.data.data.oldmakeupscore;
            this.base.oldmakeupscore2 = res.data.data.oldmakeupscore2;
            this.base.oldmakeupscorebyq = res.data.data.oldmakeupscorebyq;
          } else {
            this.$message({ type: "error", message: "数据获取失败！" });
          }
        });
      });
    },

    // reqQuerycjplanid() {},
    //点击保存按钮
    dowms() {
      let obj = {
        checkusualscore: this.base.checkusualscore, //课下成绩
        checkexperimentscore: this.base.checkexperimentscore, //课堂成绩
        checkmidtermscore: this.base.checkmidtermscore, //期中
        issue: this.base.issue, //课终考试成绩
        bkscore: this.base.oldmakeupscore, //补考成绩
        courseno: this.baseInfo.courseno, //
        onemorescore:this.base.oldmakeupscore2, //毕业前补考成绩
        prelectcourse: this.baseInfo.prelectcourse,
        name: this.firstTableList.coursemanager,
        cjxz: this.base.naturecourse,
        studentid: this.baseInfo.studentid,
        majorclass: this.firstTableList.professionaldivisions,
        xueqi: this.firstTableList.termid,
        level: this.firstTableList.traininglevel,
        planid: this.$route.query.planid,
        scorenumber: this.baseInfo.scorenumber,
        studytypecode: this.firstTableList.studytype, 
        grade: this.firstTableList.grade, //年级
        id:this.baseInfo.id
        
      };
      return new Promise(() => {
        down(obj).then((res) => {
          if(res.data.code == 200){
            this.$message({ type: "success", message: "保存成功！" });
          } else {
            this.$message({ type: "error", message: res.data.data });
          }
        });
      });
    },
    //修改保存
    // updatewinster() {
    //   let obj = {
    //     checkusualscore: this.base.checkusualscore, //课下成绩
    //     checkexperimentscore: this.base.checkexperimentscore, //课堂成绩
    //     checkmidtermscore: this.base.checkmidtermscore, //期中
    //     issue: this.base.issue, //课终考试成绩
    //     naturecourse: this.base.naturecourse, //原始成绩性质
    //     oldmakeupscore: this.base.oldmakeupscore, //补考成绩
    //     courseno: this.baseInfo.courseno, //
    //     prelectcourse: this.baseInfo.prelectcourse,
    //     studentid: this.baseInfo.studentid,
    //     name: this.baseInfo.name,
    //     planid: this.baseInfo.planid,
    //     //  修改人，修改时间
    //     //毕业前补考成绩
    //   };
    //   return new Promise(() => {
    //     updatewinster(obj).then((res) => {
    //       // if (res.data.code == 200) {
    //       //   this.base = res.data.data;
    //       //   console.log(this.baseInfo, "this.baseInfo");
    //       // }
    //     });
    //   });
    // },

    //成绩修改日志查询跳转
    toscore() {
      this.$router.push("/admin/examination/updateScore");
    },

    open(str) {
      this.$confirm(str, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "保存成功!",
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消保存",
          });
        });
    },
  },
};
</script>
<style lang="less" scoped>
.assessment-change-plan-container {
  .assessment-design {
    .el-textarea__inner {
      resize: none;
      font-size: 16px;
      color: rgba(0, 76, 167, 1);
    }
  }
}
</style>
<style scoped lang="less">
.manual-entry-container {
  > div:nth-child(1) {
    width: 1735px;
    height: 186px;
    border: 1px solid rgba(0, 76, 167, 0.8);
    border-radius: 6px;
    margin: 15px auto 0;
    ul {
      list-style: none;
      li {
        border-bottom: 1px solid rgba(0, 76, 167, 0.4);
        height: auto;
        > span {
          box-sizing: border-box;
          display: table-cell;
          font-size: 14px;
          color: rgba(0, 76, 167, 1);
          padding-left: 54px;
          border-right: 1px solid rgba(0, 76, 167, 0.4);
          height: 60px;
          // padding-top: 20px;
          vertical-align: middle;
          &:nth-child(n) {
            width: 200px;
          }

          &:last-child {
            border-right: none;
          }
          &.active {
            font-size: 16px;
            color: rgba(0, 76, 167, 1);
            font-weight: bold;
            background: rgba(77, 129, 192, 0.1);
            text-align: center;
            padding-left: 0;
          }
        }
      }
      &:nth-child(1) {
        li {
          > span {
            height: 60px;
          }
        }
      }
      &:nth-child(3) {
        li {
          border-bottom: 1px solid rgba(0, 76, 167, 0.4);
          > span {
            width: 400px;
            text-align: center;
            padding-left: 0;
            height: 60px;
            &:nth-child(1) {
              width: 144px;
            }
            &:nth-child(2) {
              width: 180px;
            }
            &:nth-child(3) {
              width: 289px;
            }
            &:nth-child(4) {
              width: 196px;
            }
            &:nth-child(5) {
              width: 197px;
            }
            &:nth-child(6) {
              width: 197px;
            }
            &:nth-child(7) {
              width: 198px;
              padding-top: 8px !important;
              > span {
                display: inline-block;
                width: 121px;
                height: 28px;
                border: 1px solid #5230e9;
                background: rgba(235, 230, 255, 1);
                opacity: 1;
                border-radius: 4px;
                font-size: 14px;
                font-weight: 400;
                color: #5230e9;
                line-height: 18px;
                margin-top: 8px;
                padding: 5px 10px;
                cursor: pointer;
              }
            }
            &:nth-child(8) {
              width: 150px;
            }
            &:nth-child(9) {
              width: 182px;
            }
            &.active {
              border-top: 1px solid rgba(0, 76, 167, 0.4);
              height: 73px;
              padding-top: 25px;
            }
          }
          &:nth-child(2) {
            > div {
              height: 57px;
              padding: 18px 30px;
              > span {
                &:nth-child(1) {
                  font-size: 16px;
                  font-weight: bold;
                  color: #004ca7;
                }
                &:nth-child(2) {
                  font-size: 14px;
                  color: #004ca7;
                }
              }
            }
          }
        }
      }
    }
    > div {
      padding: 14px 83px;
      height: 78px;
      > div:nth-child(1) {
        font-size: 16px;
        font-weight: bold;
        color: #004ca7;
        margin-bottom: 10px;
      }
      > div:nth-child(2) {
        > span {
          font-size: 14px;
          color: rgba(0, 76, 167, 1);
          margin-right: 57px;
          > span {
            color: rgba(255, 56, 25, 1);
          }
        }
      }
    }
  }
}
@import "../../../styles/print-entry.less";
.assessment-change-plan-container {
  .red-tip {
    color: red;
    margin: 0 14px;
  }
  .assessment-design {
    padding: 13px 9px !important;
    .el-textarea__inner {
      resize: none;
    }
    .red-tip {
      margin: 0 7px;
      display: inline-block;
      vertical-align: 105px;
    }
  }
  .button-group {
    margin: 50px 0;
    text-align: center;
    .btn {
      display: inline-block;
      font-size: 18px;
      padding: 6px 22px;
      border-radius: 6px;
      &:nth-child(1) {
        color: #f3b815;
        border: 1px solid #f3b815;
        background: #fff6ef;
        // margin-right: 139px;
      }
      &:nth-child(2) {
        color: #02c86c;
        border: 1px solid #02c86c;
        background: #f1fff8;
      }
    }
  }
}
</style>
